﻿using System;

namespace VXCompany.SilverlightLogging.MVVM.Models.SyncBehaviors
{
	/// <summary>
	/// Syncs at app startup.
	/// </summary>
	public class AppStartSync : PeriodicSync
	{
		/// <summary>
		/// Creates new instance, sets timer at five seconds.
		/// </summary>
		public AppStartSync()
			: base(TimeSpan.FromSeconds(5))
		{
		}

		/// <summary>
		/// Syncs once and stops.
		/// </summary>
		public override void BeginSynchronize()
		{
			base.BeginSynchronize();			
		}

		/// <summary>
		/// Stops after first sync.
		/// </summary>
		/// <param name="result"></param>
		public override void EndSynchronize(Result result)
		{
			base.EndSynchronize(result);
			Stop();
		}

		/// <summary>
		/// Returns readable name.
		/// </summary>
		public override string Name
		{
			get
			{
				return "AppStartSync";
			}
		}
	}
}
